package com.hljx.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hljx.config.Result;
import com.hljx.dto.DateDTO;
import com.hljx.entity.EtlItemSummary;
import com.hljx.service.EtlItemSummaryService;
import io.swagger.v3.oas.annotations.Operation;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author ${author}
 * @since 2023-11-09
 */
@RestController
@RequestMapping("/etlItemSummary")
public class EtlItemSummaryController {
   @Autowired
   private EtlItemSummaryService  etlItemSummaryService;


    @Operation(summary = "系统数据")
    @PostMapping("/listByPeriod")
    public Result listByPeriod(@RequestBody DateDTO dateDTO) {

        IPage<EtlItemSummary> etlItemSummaryIPage = etlItemSummaryService.listByPage(dateDTO);
        return Result.success(etlItemSummaryIPage);
    }
    @Operation(summary = "导出")
    @PostMapping("/export")
    public void export(@RequestBody DateDTO dateDTO, HttpServletResponse response) throws ClassNotFoundException {
        etlItemSummaryService.export(dateDTO,response);

    }

}
